package com.ysd.lis.controller.bac;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.bac.BacCultureCombination;
import com.ysd.lis.request.BacCultureCombinationDto;
import com.ysd.lis.request.Params;
import com.ysd.lis.service.bac.BacCultureCombinationService;
import com.ysd.testValid.ValidRepeat;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author bai
 * @since 2024-04-10
 */
@RestController
@RequestMapping("/api/bac/bac-cultrue-combination")
public class BacCultureCombinationController extends BaseController {
    @Autowired
    BacCultureCombinationService bacCultureCombinationService;

    @ApiOperation("查询")
    @GetMapping("/findBacCultureCombinationList")
    public Result findBacCultureCombinationList(BacCultureCombination bacCultureCombination) {
        return Result.succ(bacCultureCombinationService.findBacCultureCombinationList(bacCultureCombination));
    }

    @ApiOperation("增加")
    @PostMapping("/addBacCultureCombination")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "培养基组合", content = "新增培养基组合", businessName = "bacCultureCombination")
    @ValidRepeat(id = "id", tableName = "BAC_CUL_COMBINA", coloumName = "CUL_COMBINA_NO", coloumCode = "code", orgId = "orgId")
    public Result addBacCultureCombination(@RequestBody BacCultureCombination bacCultureCombination) {
        return bacCultureCombinationService.addBacCultureCombination(bacCultureCombination);
    }

    @ApiOperation("删除")
    @PostMapping("/deleteBacCultureCombination")
    @LogDetail(requestParam = "delete", operationType = OperationType.DELETE, module = "培养基组合", content = "删除培养基组合", businessName = "bacCultureCombination")
    public Result deleteBacCultureCombination(@RequestBody BacCultureCombinationDto bacCultureCombination) {
        return bacCultureCombinationService.deleteBacCultureCombination(bacCultureCombination);
    }

    @ApiOperation("修改")
    @PostMapping("/updateBacCultureCombination")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "培养基组合", content = "修改培养基组合", businessName = "bacCultureCombination")
    public Result updateBacCultureCombination(@RequestBody @Validated BacCultureCombination bacCultureCombination) {
        return bacCultureCombinationService.updateBacCultureCombination(bacCultureCombination);
    }

    @ApiOperation("根据类型获取培养基组合")
    @GetMapping("/findBacCultureCombinationListByType")
    public Result findBacCultureCombinationListByType(Params params) {
        return bacCultureCombinationService.findBacCultureCombinationListByType(params);
    }

    @ApiOperation("根据培养基组合ID查询培养基")
    @GetMapping("/findBacCultureCombinationListById")
    public Result findBacCultureCombinationListById(@RequestParam String id) {
        return bacCultureCombinationService.findBacCultureCombinationListById(id);
    }

    @ApiOperation("根据培养基组合ID数组查询培养基")
    @GetMapping("/findBacCultureCombinationListByIdList")
    public Result findBacCultureCombinationListByIdList(@RequestParam("idList[]") List<String> idList) {
        return bacCultureCombinationService.findBacCultureCombinationListByIdList(idList);
    }

    @ApiOperation("根据培养基组合ID数组查询培养基")
    @GetMapping("/findBacCultureCombinationListByIds")
    public Result findBacCultureCombinationListByIds(@RequestParam("ids[]") List<String> ids) {
        return bacCultureCombinationService.findBacCultureCombinationListByIds(ids);
    }

    @ApiOperation("批量操作")
    @GetMapping("/updateCultureCombinationListByIds")
    public Result updateCultureCombinationListByIds(@RequestParam("ids[]") List<String> ids) {
        return bacCultureCombinationService.updateCultureCombinationListByIds(ids);
    }


}
